home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / mflms101.arc / MFLSTRNG.H < prev    next >
C/C++ Source or Header  |  1989-11-25  |  4KB  |  99 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*  MFLSTRNG Header file                                                */
  4. /*                                                                      */
  5. /*  MicroFirm Function Library string functions.                        */
  6. /*                                                                      */
  7. /*  Copyright 1988-89 by Robert B. Stout dba MicroFirm                  */
  8. /*  All rights reserved                                                 */
  9. /*                                                                      */
  10. /*  Copyright 1986, 1987 by S.E. Margison                               */
  11. /*                                                                      */
  12. /*  Compiled by QC 2.0 for use with MSC 5.1 or QC 2.0 or later.         */
  13. /*                                                                      */
  14. /************************************************************************/
  15.  
  16. #ifndef MFLSTRNG_H
  17. #define MFLSTRNG_H
  18.  
  19. #include <mfldefs.h>
  20.  
  21. #define LAST_CHAR(string) (((char *)string)[strlen(string)-1])
  22. #define NEXT_TO_LAST_CHAR(string) (((char *)string)[strlen(string)-2])
  23. #define STRING_TERMINATOR(string) (((char *)string)[strlen(string)])
  24. #define STREQ(str1,str2) (!strcmp(str1,str2))
  25. #define STREQI(str1,str2) (!strcmpl(str1,str2))
  26.  
  27. /* The following may cause problems when porting code           */
  28. /* If so, simply #undefine index and rindex                     */
  29.  
  30. #define index(s,c)  ((strchr(s,c)) ? (int)(strchr(s,c)-s) : -1)
  31. #define rindex(s,c) ((strrchr(s,c)) ? (int)(strrchr(s,c)-s) : -1)
  32.  
  33. #ifndef _Cdecl_
  34.  #ifdef NO_EXT_KEYS
  35.   #define _Cdecl_
  36.  #else
  37.   #define _Cdecl_ cdecl
  38.  #endif
  39. #endif
  40.  
  41. /************************************************************************/
  42. /*                                                                      */
  43. /*  BASIC-like string functions                                         */
  44. /*                                                                      */
  45. /************************************************************************/
  46.  
  47. extern int STR_pool_size;
  48. extern LOGICAL STRALLOC_OK;
  49.  
  50. char * _Cdecl_ stralloc(int);
  51. char * _Cdecl_ left(char *, int);
  52. char * _Cdecl_ right(char *, int);
  53. char * _Cdecl_ mid(char *, int, int);
  54. char * _Cdecl_ string_add(char *, ...);
  55. int    _Cdecl_ str_init(int, int);
  56. void   _Cdecl_ str_free(void);
  57.  
  58. /************************************************************************/
  59. /*                                                                      */
  60. /*  String translation functions                                        */
  61. /*                                                                      */
  62. /************************************************************************/
  63.  
  64. int _Cdecl_ strxlat(char *, char *, char *);
  65. int _Cdecl_ strixlat(char *, char *, char *);
  66. int _Cdecl_ strnxlat(char *, char *, char *, int);
  67. int _Cdecl_ strnixlat(char *, char *, char *, int);
  68.  
  69. /************************************************************************/
  70. /*                                                                      */
  71. /*  Functions to remove whitespace                                      */
  72. /*                                                                      */
  73. /************************************************************************/
  74.  
  75. void    _Cdecl_ strip(char *),
  76.         _Cdecl_ lv1ws(char *);
  77.  
  78. char *  _Cdecl_ rmlead(char *),
  79.      *  _Cdecl_ rmtrail(char *),
  80.      *  _Cdecl_ rmallws(char *);
  81.  
  82. /************************************************************************/
  83. /*                                                                      */
  84. /*  Miscellaneous functions                                             */
  85. /*                                                                      */
  86. /************************************************************************/
  87.  
  88. void    _Cdecl_ fillch(char *, char, int),
  89.         _Cdecl_ loadstr(char *, char *, int);
  90.  
  91. int     _Cdecl_ argval(char *, int *, int),
  92.         _Cdecl_ center(char *, int),
  93.         _Cdecl_ dstr_i(char *, int*),
  94.         _Cdecl_ i_dstr(char *, int);
  95.  
  96. unsigned int _Cdecl_ hstr_i(char *);
  97.  
  98. #endif /* MFLSTRNG_H */
  99.